/**
 * @author        hejiyang <silentmanager@163.com>
 * @date          2024-11-09 23:52:08
 * Copyright © YourCompanyName All rights reserved
 */
import request from '@/config/axios'

// 更新套餐管理
export const updatePackageManagement = async (data) => {
  return await request.put({ url: `/bms/package-management/update`, data })
}

// 关联酒水
export const relatedPackageManagement = async (data) => {
  return await request.post({ url: `/bms/package-management/related`, data })
}

// 创建套餐管理
export const createPackageManagement = async (data) => {
  return await request.post({ url: `/bms/package-management/create`, data })
}
export interface PagePackageManagementRes {
  bonusRule: number
  bottleCount: number
  createTime: string
  drinks: string | null
  id: number
  isListed: boolean
  packageCode: string
  packageContent: string
  packageCount: number
  packageName: string
  packageRevenue: number
  price: number
  priceOffset: number
  originBottleCount: number
  originPackageCount: number
  packageContentList: {
    bottleCount: number
    drinkName: string
    num: number
    packageCount: number
    stock: number
  }[]
}

// 获得套餐管理分页
export const pagePackageManagement = async (params) => {
  return await request.get<{ list: PagePackageManagementRes[]; total: number }>({
    url: `/bms/package-management/page`,
    params
  })
}

// 获得套餐管理
export const getPackageManagement = async (id: string) => {
  return await request.get({ url: `/bms/package-management/get?id=${id}` })
}

// // 导出套餐管理 Excel
// export const exportExcelPackageManagement = async (params) => {
//   return await request.get({ url: `/bms/package-management/export-excel`, params })
// }

// 删除套餐管理
export const deletePackageManagement = async (id: number) => {
  return await request.delete({ url: `/bms/package-management/delete?id=${id}` })
}
